<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qqmlengine.cpp -->
  <title>Qt QML 类型| Qt QML 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtqml-index.html">Qt QML</a></td><td ><a href="qtqml-qmlmodule.html">QML Types</a></td><td >Qt QML 类型</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtqml-index.html">Qt 
5.12.3 <span lang="zh-cn">参考指南</span></a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc"><span lang="zh-cn">目录</span></a></h3>
<ul>
<li class="level1"><a href="#properties"><span lang="zh-cn">属性</span></a></li>
<li class="level1"><a href="#methods">方法</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
<li class="level2"><a href="#enums">Enums</a></li>
<li class="level2"><a href="#types">Types</a></li>
<li class="level2"><a href="#date-time-formatters">日期/时间格式器</a></li>
<li class="level2"><a href="#dynamic-object-creation">动态对象创建</a></li>
<li class="level2"><a href="#other-functions">其他函数</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt QML<span lang="zh-cn"> 类型</span></h1>
<span class="subtitle"></span>
<!-- $$$Qt-brief -->
<p>提供了一个全局对象和有用的枚举和函数从Qt。 <a href="#details"><span lang="zh-cn">更多</span>...</a></p>
<!-- @@@Qt -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> <span lang="zh-cn">导入语句</span>:</td><td class="memItemRight bottomAlign"> import QtQml 2.12</td></tr></table></div><ul>
<li><a href="qml-qtqml-qt-members.html"><span lang="zh-cn">所有成员列表，包括继承成员</span></a></li>
</ul>
<a name="properties"></a>
<h2 id="properties"><span lang="zh-cn">属性</span></h2>
<ul>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#application-prop">application</a></b></b> : object</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#inputMethod-prop">inputMethod</a></b></b> : object</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#platform-prop">platform</a></b></b> : object</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#styleHints-prop">styleHints</a></b></b> : object</li>
</ul>
<a name="methods"></a>
<h2 id="methods">方法</h2>
<ul>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#atob-method">atob</a></b></b>(<i>data</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#binding-method">binding</a></b></b>(<i>function</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#btoa-method">btoa</a></b></b>(<i>data</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#callLater-method">callLater</a></b></b>(<i>function</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#callLater-method-1">callLater</a></b></b>(<i>function</i>, <i>argument1</i>, <i>argument2</i>, <i> ...</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#colorEqual-method">colorEqual</a></b></b>(color <i>lhs</i>,  string <i>rhs</i>)</li>
<li class="fn">object <b><b><a href="qml-qtqml-qt.html#createComponent-method">createComponent</a></b></b>(<i>url</i>, <i>mode</i>, <i>parent</i>)</li>
<li class="fn">object <b><b><a href="qml-qtqml-qt.html#createQmlObject-method">createQmlObject</a></b></b>(string <i>qml</i>,  object <i>parent</i>,  string <i>filepath</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#darker-method">darker</a></b></b>(color <i>baseColor</i>,  real <i>factor</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#exit-method">exit</a></b></b>(int <i>retCode</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#font-method">font</a></b></b>(object <i>fontSpecifier</i>)</li>
<li class="fn">list&lt;string&gt; <b><b><a href="qml-qtqml-qt.html#fontFamilies-method">fontFamilies</a></b></b>()</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#formatDate-method">formatDate</a></b></b>(datetime <i>date</i>,  variant <i>format</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#formatDateTime-method">formatDateTime</a></b></b>(datetime <i>dateTime</i>,  variant <i>format</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#formatTime-method">formatTime</a></b></b>(datetime <i>time</i>,  variant <i>format</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#hsla-method">hsla</a></b></b>(real <i>hue</i>,  real <i>saturation</i>,  real <i>lightness</i>,  real <i>alpha</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#hsva-method">hsva</a></b></b>(real <i>hue</i>,  real <i>saturation</i>,  real <i>value</i>,  real <i>alpha</i>)</li>
<li class="fn">object <b><b><a href="qml-qtqml-qt.html#include-method">include</a></b></b>(string <i>url</i>,  jsobject <i>callback</i>)</li>
<li class="fn">bool <b><b><a href="qml-qtqml-qt.html#isQtObject-method">isQtObject</a></b></b>(<i>object</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#lighter-method">lighter</a></b></b>(color <i>baseColor</i>,  real <i>factor</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#locale-method">locale</a></b></b>(<i>name</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#md5-method">md5</a></b></b>(<i>data</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#matrix4x4-method">matrix4x4</a></b></b>(real <i>m11</i>,  real <i>m12</i>,  real <i>m13</i>,  real <i>m14</i>,  real <i>m21</i>,  real <i>m22</i>,  real <i>m23</i>,  real <i>m24</i>,  real <i>m31</i>,  real <i>m32</i>,  real <i>m33</i>,  real <i>m34</i>,  real <i>m41</i>,  real <i>m42</i>,  real <i>m43</i>,  real <i>m44</i>)</li>
<li class="fn">bool <b><b><a href="qml-qtqml-qt.html#openUrlExternally-method">openUrlExternally</a></b></b>(url <i>target</i>)</li>
<li class="fn">point <b><b><a href="qml-qtqml-qt.html#point-method">point</a></b></b>(int <i>x</i>,  int <i>y</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#qsTr-method">qsTr</a></b></b>(string <i>sourceText</i>,  string <i>disambiguation</i>,  int <i>n</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#qsTrId-method">qsTrId</a></b></b>(string <i>id</i>,  int <i>n</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#qsTrIdNoOp-method">qsTrIdNoOp</a></b></b>(string <i>id</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#qsTrNoOp-method">qsTrNoOp</a></b></b>(string <i>sourceText</i>,  string <i>disambiguation</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#qsTranslate-method">qsTranslate</a></b></b>(string <i>context</i>,  string <i>sourceText</i>,  string <i>disambiguation</i>,  int <i>n</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-qt.html#qsTranslateNoOp-method">qsTranslateNoOp</a></b></b>(string <i>context</i>,  string <i>sourceText</i>,  string <i>disambiguation</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#quaternion-method">quaternion</a></b></b>(real <i>scalar</i>,  real <i>x</i>,  real <i>y</i>,  real <i>z</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#quit-method">quit</a></b></b>()</li>
<li class="fn">rect <b><b><a href="qml-qtqml-qt.html#rect-method">rect</a></b></b>(int <i>x</i>,  int <i>y</i>,  int <i>width</i>,  int <i>height</i>)</li>
<li class="fn">url <b><b><a href="qml-qtqml-qt.html#resolvedUrl-method">resolvedUrl</a></b></b>(url <i>url</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#rgba-method">rgba</a></b></b>(real <i>red</i>,  real <i>green</i>,  real <i>blue</i>,  real <i>alpha</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#size-method">size</a></b></b>(int <i>width</i>,  int <i>height</i>)</li>
<li class="fn">color <b><b><a href="qml-qtqml-qt.html#tint-method">tint</a></b></b>(color <i>baseColor</i>,  color <i>tintColor</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#vector2d-method">vector2d</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#vector3d-method">vector3d</a></b></b>(real <i>x</i>,  real <i>y</i>,  real <i>z</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-qt.html#vector4d-method">vector4d</a></b></b>(real <i>x</i>,  real <i>y</i>,  real <i>z</i>,  real <i>w</i>)</li>
</ul>
<!-- $$$Qt-description -->
<a name="details"></a>
<h2 id="details">详细信息</h2>
<p><code>Qt</code> 对象是一个具有实用函数、属性和枚举的全局对象。</p>
<p>它不是可实例化的;要使用它，直接调用全局Qt对象的成员。例如:</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>)
      <span class="name">text</span>: <span class="name">Qt</span>.<span class="name">md5</span>(<span class="string">&quot;hello, world&quot;</span>)
  }

</pre>
<a name="enums"></a>
<h2 id="enums"><span lang="zh-cn">宏</span></h2>
<p>Qt对象包含在<a href="../qtcore/qt.html">Qt命名空间中</a>可用的枚举。<br>例如，您可以访问<a href="../qtcore/qt.html#MouseButton-enum">Qt::LeftButton</a>和<a href="../qtcore/qt.html#MouseButton-enum">Qt::RightButton</a>枚举值作为<code>Qt.LeftButton</code>和<code>Qt.RightButton</code>n。</p>
<a name="types"></a>
<h2 id="types"><span lang="zh-cn">类型</span></h2>
<p>Qt对象还包含用于创建特定数据类型对象的辅助函数。当属性具有以下类型之一时，这在设置项的属性时非常有用:</p>
<ul>
<li><code>rect</code> - <span lang="zh-cn">使用 </span>
<a href="qml-qtqml-qt.html#rect-method">Qt.rect()</a></li>
<li><code>point</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#point-method">Qt.point()</a></li>
<li><code>size</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#size-method">Qt.size()</a></li>
</ul>
<p>如果已经导入<code>QtQuick</code> 模块，客户端还可以使用以下用于创建特定数据类型对象的帮助函数:</p>
<ul>
<li><code>color</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#rgba-method">Qt.rgba()</a>, <a href="qml-qtqml-qt.html#hsla-method">Qt.hsla()</a>, <a href="qml-qtqml-qt.html#darker-method">Qt.darker()</a>, <a href="qml-qtqml-qt.html#lighter-method">Qt.lighter()</a> 
<span lang="zh-cn">和</span> <a href="qml-qtqml-qt.html#tint-method">Qt.tint()</a></li>
<li><code>font</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#font-method">Qt.font()</a></li>
<li><code>vector2d</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#vector2d-method">Qt.vector2d()</a></li>
<li><code>vector3d</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#vector3d-method">Qt.vector3d()</a></li>
<li><code>vector4d</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#vector4d-method">Qt.vector4d()</a></li>
<li><code>quaternion</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#quaternion-method">Qt.quaternion()</a></li>
<li><code>matrix4x4</code> - <span lang="zh-cn">使用</span> <a href="qml-qtqml-qt.html#matrix4x4-method">Qt.matrix4x4()</a></li>
</ul>
<p>这些类型也有基于字符串的构造函数。有关更多信息，请参阅<a href="qtqml-typesystem-basictypes.html">QML基本类型</a>。</p>
<a name="date-time-formatters"></a>
<h2 id="date-time-formatters">日期/时间格式器</h2>
<p>Qt对象包含几个用于格式化<a href="../qtcore/qdatetime.html">QDateTime</a>、<a href="../qtcore/qdate.html">QDate</a>和<a href="../qtcore/qtime.html">QTime</a>值的函数。</p>
<ul>
<li><a href="qml-qtqml-qt.html#formatDateTime-method">string Qt.formatDateTime(datetime date, variant format)</a></li>
<li><a href="qml-qtqml-qt.html#formatDate-method">string Qt.formatDate(datetime date, variant format)</a></li>
<li><a href="qml-qtqml-qt.html#formatTime-method">string Qt.formatTime(datetime date, variant format)</a></li>
</ul>
<p>格式规范见<a href="qml-qtqml-qt.html#formatDateTime-method">Qt.formatDateTime</a>。</p>
<a name="dynamic-object-creation"></a>
<h2 id="dynamic-object-creation">动态对象创建</h2>
<p>下面的全局对象函数允许您从文件或字符串动态创建QML项。请参阅<a href="qtqml-javascript-dynamicobjectcreation.html">从JavaScript创建动态QML对象</a>来了解它们的使用概况。</p>
<ul>
<li><a href="qml-qtqml-qt.html#createComponent-method">object Qt.createComponent(url)</a></li>
<li><a href="qml-qtqml-qt.html#createQmlObject-method">object Qt.createQmlObject(string qml, object parent, string filepath)</a></li>
</ul>
<a name="other-functions"></a>
<h2 id="other-functions">其他函数</h2>
<p>以下函数也在Qt对象上。</p>
<ul>
<li><a href="qml-qtqml-qt.html#quit-method">Qt.quit()</a></li>
<li><a href="qml-qtqml-qt.html#md5-method">Qt.md5(string)</a></li>
<li><a href="qml-qtqml-qt.html#btoa-method">string Qt.btoa(string)</a></li>
<li><a href="qml-qtqml-qt.html#atob-method">string Qt.atob(string)</a></li>
<li><a href="qml-qtqml-qt.html#binding-method">object Qt.binding(function)</a></li>
<li><a href="qml-qtqml-qt.html#locale-method">object Qt.locale()</a></li>
<li><a href="qml-qtqml-qt.html#resolvedUrl-method">string Qt.resolvedUrl(string)</a></li>
<li><a href="qml-qtqml-qt.html#openUrlExternally-method">Qt.openUrlExternally(string)</a></li>
<li><a href="qml-qtqml-qt.html#fontFamilies-method">list&lt;string&gt; Qt.fontFamilies()</a></li>
</ul>
<!-- @@@Qt -->
<h2><span lang="zh-cn">属性文档</span></h2>
<!-- $$$application -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="application-prop">
<td class="tblQmlPropNode"><p>
<a name="application-prop"></a><span class="name">application</span> : <span class="type">object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>应用程序<span lang="zh-cn">（<code>application</code> ）</span>对象提供对由许多QML组件共享的全局应用程序状态属性的访问。</p>
<p>它的属性有:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><code>application.active</code></td><td >
	 已弃用，请使用Qt.application.state == Qt.ApplicationActive代替。</td></tr>
<tr valign="top" class="even"><td ><code>application.state</code></td><td >
	此只读属性指示应用程序的当前状态。<p>可能的值是:</p>
<ul>
<li>Qt.ApplicationActive - 应用程序是最顶层和最集中的应用程序，用户可以与应用程序交互。</li>
<li>Qt.ApplicationInactive - 
应用程序是可见的或部分可见的，但没有选择在前面，用户不能与应用程序交互。在桌面平台上，这通常意味着用户激活了另一个应用程序。在移动平台上，当操作系统用来电、短信或对话打断用户时，更常见的情况是进入这种状态。这通常是应用程序暂停的一个临时状态。用户可能会将焦点返回到应用程序，但大多数情况下，这将是应用程序将要挂起的第一个迹象。<br>
在这种状态下，当用户无法与应用程序交互时，可以考虑暂停或停止任何不应该继续的活动，例如视频、游戏、动画或传感器。您还应该避免执行cpu密集型任务，这可能会在前面降低应用程序的速度。</li>
<li>Qt.ApplicationSuspended - 
应用程序被挂起并且对用户不可见。在移动平台上，当用户返回主屏幕或切换到另一个应用程序时，应用程序通常会进入这种状态。在这种状态下，应用程序应该确保用户认为它始终是活的，并且不会丢失进度，保存任何持久数据。应用程序应该停止所有活动，并做好代码执行停止的准备。当挂起时，应用程序可以在任何时候被终止，而不会发出进一步的警告(例如，当内存不足迫使操作系统清除挂起的应用程序时)。</li>
<li>Qt.ApplicationHidden - 
应用程序是隐藏的，并在后台运行。当用户与其他应用程序交互时，这是需要进行后台处理(比如播放音乐)的应用程序的正常状态。当进入这个状态时，应用程序应该释放所有图形资源。Qt 
Quick应用程序通常不应该在QML级别处理这种状态。相反，您应该在应用程序再次活动时卸载整个UI并重新加载QML文件。</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><code>application.layoutDirection</code></td><td >此只读属性可用于查询应用程序的默认布局方向。在系统启动时，默认的布局方向取决于应用程序的语言。在文本和图形元素从右向左读取的地区中，该属性的值为<code>Qt.RightToLeft</code>，在读取方向从左向右流动的地区中，该属性的值为<code>Qt.LeftToRight</code>。您可以绑定到此属性来定制应用程序布局，以支持两个布局方向。<p>
	可能的值是:</p>
<ul>
<li>Qt.LeftToRight - 文本和图形元素应该从左到右定位。</li>
<li>Qt.RightToLeft - 文本和图形元素应该从右到左定位.</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><code>application.font</code></td><td >
	这个只读属性保存由<a href="../qtgui/qguiapplication.html#font">QGuiApplication::font()</a>返回的默认应用程序字体 
	<span lang="zh-cn">。</span></td></tr>
<tr valign="top" class="odd"><td ><code>application.arguments</code></td><td >
	这是可执行文件调用时使用的参数的字符串列表。</td></tr>
<tr valign="top" class="even"><td ><code>application.name</code></td><td >这是在<a href="../qtcore/qcoreapplication.html">QCoreApplication</a>实例上设置的应用程序名称。可以将此属性写入以设置应用程序名称。</td></tr>
<tr valign="top" class="odd"><td ><code>application.displayName</code> (<span lang="zh-cn">从Qt5.9</span>)</td><td >
	这是在<a href="../qtgui/qguiapplication.html">QGuiApplication</a>实例上设置的应用程序显示名称。可以将此属性写入以设置应用程序显示名称。</td></tr>
<tr valign="top" class="even"><td ><code>application.version</code></td><td >这是在<a href="../qtcore/qcoreapplication.html">QCoreApplication</a>实例上设置的应用程序版本。可以将此属性写入以设置应用程序版本。</td></tr>
<tr valign="top" class="odd"><td ><code>application.organization</code></td><td >
	这是在<a href="../qtcore/qcoreapplication.html">QCoreApplication</a>实例上设置的组织名称。<br>
	可以将此属性写入以设置组织名称。</td></tr>
<tr valign="top" class="even"><td ><code>application.domain</code></td><td >这是在<a href="../qtcore/qcoreapplication.html">QCoreApplication</a>实例上设置的组织域。<br>
	可以将此属性写入以设置组织域。</td></tr>
<tr valign="top" class="odd"><td ><code>application.supportsMultipleWindows</code></td><td >
	此只读属性可用于确定平台是否支持多个窗口。例如，一些嵌入式平台不支持多个窗口。</td></tr>
<tr valign="top" class="even"><td ><code>application.screens</code></td><td >&nbsp;包含所有连接屏幕的描述的数组。数组的元素是与<a href="../qtquick/qml-qtquick-window-screen.html">Screen</a>附加对象具有相同属性的对象。实际上，该数组对应于 <a href="../qtgui/qguiapplication.html#screens">QGuiApplication::screens()</a>返回的屏幕列表。除了检查名称、宽度、高度等属性外，数组元素还可以被赋给Window项目的screen属性，从而作为C++方面的<a href="../qtgui/qwindow.html#setScreen">QWindow::setScreen()</a>的替代方法。这个属性已经在Qt 
	5.9中添加。</td></tr>
</table></div>
<p>该对象也有一个信号，aboutToQuit()，它与<a href="../qtcore/qcoreapplication.html#aboutToQuit">QCoreApplication::aboutToQuit()</a>相同 
<span lang="zh-cn">。</span></p>
<p>下面的示例使用application对象来指示应用程序当前是否处于活动状态:</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">55</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">application</span>.<span class="name">active</span> ? <span class="string">&quot;white&quot;</span> : <span class="string">&quot;lightgray&quot;</span>
      <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
          <span class="name">text</span>: <span class="string">&quot;Application &quot;</span> <span class="operator">+</span> (<span class="name">Qt</span>.<span class="name">application</span>.<span class="name">active</span> ? <span class="string">&quot;active&quot;</span> : <span class="string">&quot;inactive&quot;</span>)
          <span class="name">opacity</span>: <span class="name">Qt</span>.<span class="name">application</span>.<span class="name">active</span> ? <span class="number">1.0</span> : <span class="number">0.5</span>
          <span class="name">anchors</span>.centerIn: <span class="name">parent</span>
      }
  }

</pre>
<p>注意，当使用不带<a href="../qtgui/qguiapplication.html">QGuiApplication</a>的QML时，以下属性将是未定义的:</p>
<ul>
<li>application.active</li>
<li>application.state</li>
<li>application.layoutDirection</li>
<li>application.font</li>
</ul>
<p>这个属性在Qt 5.1中被引入。</p>
<p><b><span lang="zh-cn">请参考</span> </b><a href="../qtquick/qml-qtquick-window-screen.html">Screen</a>, <a href="../qtquick/qml-qtquick-window-window.html">Window</a>,<span lang="zh-cn"> 
以及</span> <a href="../qtquick/qml-qtquick-window-window.html#screen-prop">Window.screen</a>.</p>
</div></div><!-- @@@application -->
<br/>
<!-- $$$inputMethod -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="inputMethod-prop">
<td class="tblQmlPropNode"><p>
<a name="inputMethod-prop"></a><span class="name">inputMethod</span> : <span class="type">object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p><a href="../qtgui/qinputmethod.html">QInputMethod</a> <code>inputMethod</code> 
		对象允许访问应用程序的<a href="../qtgui/qinputmethod.html">QInputMethod</a>对象及其所有属性和槽。<br>
		更多细节请参阅<a href="../qtgui/qinputmethod.html">QInputMethod</a>文档。</p>
<p>这个属性是在Qt 5.0中引入的。</p>
</div></div><!-- @@@inputMethod -->
<br/>
<!-- $$$platform -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="platform-prop">
<td class="tblQmlPropNode"><p>
<a name="platform-prop"></a><span class="name">platform</span> : <span class="type">object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>&nbsp;<code>platform</code> 对象提供关于底层平台的信息。</p>
<p>它的属性有:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><code>platform.os</code></td><td >
	 此只读属性包含操作系统的名称。<p>可能的值是:</p>
<ul>
<li><code>&quot;android&quot;</code> - Android</li>
<li><code>&quot;ios&quot;</code> - iOS</li>
<li><code>&quot;tvos&quot;</code> - tvOS</li>
<li><code>&quot;linux&quot;</code> - Linux</li>
<li><code>&quot;osx&quot;</code> - <a href="../qtdoc/internationalization.html#macos">macOS</a></li>
<li><code>&quot;qnx&quot;</code> - QNX (since Qt 5.9&#x2e;3)</li>
<li><code>&quot;unix&quot;</code> - Other Unix-based OS</li>
<li><code>&quot;windows&quot;</code> - Windows</li>
<li><code>&quot;winrt&quot;</code> - <a href="../qtdoc/supported-platforms.html#winrt">WinRT</a> / UWP</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><code>platform.pluginName</code></td><td >
	<span lang="zh-cn">这是在<a href="../qtgui/qguiapplication.html">QGuiApplication</a>实例上设置的平台名称，由<a href="../qtgui/qguiapplication.html#platformName-prop">QGuiApplication::platformName()</a>返回。</span></td></tr>
</table></div>
<p>这个属性在Qt 5.1中被引入。</p>
</div></div><!-- @@@platform -->
<br/>
<!-- $$$styleHints -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="styleHints-prop">
<td class="tblQmlPropNode"><p>
<a name="styleHints-prop"></a><span class="name">styleHints</span> : <span class="type">object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p><code>styleHints</code> 对象提供特定于平台的样式提示和设置。<br>
		更多细节请参阅<a href="../qtgui/qstylehints.html">QStyleHints</a>文档。</p>
<p><b><span lang="zh-cn">注意</span>:</b> <code>styleHints</code>对象只在使用Qt 
Quick模块时可用。</p><p>下面的例子使用了<code>styleHints</code> 对象来决定一个项目是应该在鼠标按下还是触摸释放时获得焦点:</p>
<pre class="cpp">

  import <span class="type">QtQuick</span> <span class="number">2.4</span>

  MouseArea {
      id: button

      onPressed: {
          <span class="keyword">if</span> (<span class="operator">!</span><span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>styleHints<span class="operator">.</span>setFocusOnTouchRelease)
              button<span class="operator">.</span>forceActiveFocus()
      }
      onReleased: {
          <span class="keyword">if</span> (<span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>styleHints<span class="operator">.</span>setFocusOnTouchRelease)
              button<span class="operator">.</span>forceActiveFocus()
      }
  }

</pre>
<p>这个属性是在Qt 5.5中引入的。</p>
</div></div><!-- @@@styleHints -->
<br/>
<h2><span lang="zh-cn">方法文档</span></h2>
<!-- $$$ -->
<div class="qmlitem"><div class="fngroup">
<div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="callLater-method"></a><span class="name">callLater</span>(<i>function</i>)</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="callLater-method-1"></a><span class="name">callLater</span>(<i>function</i>, <i>argument1</i>, <i>argument2</i>, <i> ...</i>)</p></td></tr>
</table></div>
</div></div><div class="qmldoc"><p>使用此函数可消除对函数或信号的冗余调用。</p>
<p>一旦QML引擎返回到事件循环，作为第一个参数传递给Qt.<a href="qml-qtqml-qt.html#callLater-method">callLater()</a>的函数将在稍后调用。</p>
<p>当这个函数以同一个函数作为其第一个参数快速连续调用多次时，该函数只会被调用一次。</p>
<p>例如:</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">480</span>
      <span class="name">height</span>: <span class="number">320</span>

      property <span class="type"><a href="qml-int.html">int</a></span> <span class="name">callsToUpdateMinimumWidth</span>: <span class="number">0</span>
      property <span class="type"><a href="qml-bool.html">bool</a></span> <span class="name">optimize</span>: <span class="number">true</span>

      property <span class="type"><a href="qml-int.html">int</a></span> <span class="name">currentTextModel</span>: <span class="number">0</span>
      property <span class="type"><a href="qml-var.html">var</a></span> <span class="name">columnTexts</span>: [
          [<span class="string">&quot;Click on either&quot;</span>, <span class="string">&quot;rectangle above&quot;</span>, <span class="string">&quot;and note how the counter&quot;</span>, <span class="string">&quot;below updates&quot;</span>, <span class="string">&quot;significantly faster using the&quot;</span>, <span class="string">&quot;regular (non-optimized)&quot;</span>, <span class="string">&quot;implementation&quot;</span>],
          [<span class="string">&quot;The width&quot;</span>, <span class="string">&quot;of this column&quot;</span>, <span class="string">&quot;is&quot;</span>, <span class="string">&quot;no wider than the&quot;</span>, <span class="string">&quot;widest item&quot;</span>],
          [<span class="string">&quot;Note how using Qt.callLater()&quot;</span>, <span class="string">&quot;the minimum width is&quot;</span>, <span class="string">&quot;calculated a bare-minimum&quot;</span>, <span class="string">&quot;number&quot;</span>, <span class="string">&quot;of times&quot;</span>]
      ]

      <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
          <span class="name">x</span>: <span class="number">20</span>; <span class="name">y</span>: <span class="number">280</span>
          <span class="name">text</span>: <span class="string">&quot;Times minimum width has been calculated: &quot;</span> <span class="operator">+</span> <span class="name">callsToUpdateMinimumWidth</span>
      }

      <span class="type"><a href="../qtquick/qml-qtquick-row.html">Row</a></span> {
          <span class="name">y</span>: <span class="number">25</span>; <span class="name">spacing</span>: <span class="number">30</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span>
          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="number">200</span>; <span class="name">height</span>:  <span class="number">50</span>; <span class="name">color</span>: <span class="string">&quot;lightgreen&quot;</span>
              <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="string">&quot;Optimized behavior\nusing Qt.callLater()&quot;</span>; <span class="name">anchors</span>.centerIn: <span class="name">parent</span> }
              <span class="type"><a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">onClicked</span>: { <span class="name">optimize</span> <span class="operator">=</span> <span class="number">true</span>; currentTextModel++ } }
          }
          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="number">200</span>; <span class="name">height</span>:  <span class="number">50</span>; <span class="name">color</span>: <span class="string">&quot;lightblue&quot;</span>
              <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="string">&quot;Regular behavior&quot;</span>; <span class="name">anchors</span>.centerIn: <span class="name">parent</span>}
              <span class="type"><a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">onClicked</span>: { <span class="name">optimize</span> <span class="operator">=</span> <span class="number">false</span>; currentTextModel++ } }
          }
      }

      <span class="type"><a href="../qtquick/qml-qtquick-column.html">Column</a></span> {
          <span class="name">id</span>: <span class="name">column</span>
          <span class="name">anchors</span>.centerIn: <span class="name">parent</span>

          <span class="name">onChildrenChanged</span>: <span class="name">optimize</span> ? <span class="name">Qt</span>.<span class="name">callLater</span>(<span class="name">updateMinimumWidth</span>) : <span class="name">updateMinimumWidth</span>()

          property <span class="type"><a href="qml-int.html">int</a></span> <span class="name">widestChild</span>
          <span class="keyword">function</span> <span class="name">updateMinimumWidth</span>() {
              callsToUpdateMinimumWidth++
              var w = <span class="number">0</span>;
              <span class="keyword">for</span> (var i in <span class="name">children</span>) {
                  var child = <span class="name">children</span>[<span class="name">i</span>];
                  <span class="keyword">if</span> (<span class="name">child</span>.<span class="name">implicitWidth</span> <span class="operator">&gt;</span> <span class="name">w</span>) {
                      <span class="name">w</span> <span class="operator">=</span> <span class="name">child</span>.<span class="name">implicitWidth</span>;
                  }
              }

              <span class="name">widestChild</span> <span class="operator">=</span> <span class="name">w</span>;
          }

          <span class="type"><a href="../qtquick/qml-qtquick-repeater.html">Repeater</a></span> {
              <span class="name">id</span>: <span class="name">repeater</span>
              <span class="name">model</span>: <span class="name">columnTexts</span>[<span class="name">currentTextModel</span><span class="operator">%</span><span class="number">3</span>]
              <span class="name">delegate</span>: <span class="name">Text</span> {
                  <span class="name">color</span>: <span class="string">&quot;white&quot;</span>
                  <span class="name">text</span>: <span class="name">modelData</span>
                  <span class="name">width</span>: <span class="name">column</span>.<span class="name">widestChild</span>
                  <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">Center</span>
                  <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">z</span>: -<span class="number">1</span>; <span class="name">color</span>: <span class="name">index</span><span class="operator">%</span><span class="number">2</span> ? <span class="string">&quot;gray&quot;</span> : <span class="string">&quot;darkgray&quot;</span> }
              }
          }
      }
  }

</pre>
<p>传递给 Qt.<a href="qml-qtqml-qt.html#callLater-method">callLater()</a> 
的任何附加参数都将传递给被调用的函数。注意，如果消除了冗余调用，则只将最后一组参数传递给函数。</p>
<p>本文档是在Qt 5.8中引入的。</p>
</div></div><!-- @@@ -->
<br/>
<!-- $$$atob -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="atob-method">
<td class="tblQmlFuncNode"><p>
<a name="atob-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">atob</span>(<i>data</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>这个函数将base64编码的数据字符串解码并返回。</p>
</div></div><!-- @@@atob -->
<br/>
<!-- $$$binding -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="binding-method">
<td class="tblQmlFuncNode"><p>
<a name="binding-method"></a><span class="name">binding</span>(<i>function</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回一个表示<a href="qtqml-syntax-propertybinding.html">属性绑定</a>的JavaScript对象。 </p>
<p>该函数有两个主要用例:首先，从JavaScript代码强制应用属性绑定:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      property <span class="type"><a href="qml-bool.html">bool</a></span> <span class="name">someCondition</span>: <span class="number">true</span>
      property <span class="type"><a href="qml-int.html">int</a></span> <span class="name">edgePosition</span>

      <span class="name">Component</span>.onCompleted: {
          <span class="keyword">if</span> (<span class="name">someCondition</span> <span class="operator">==</span> <span class="number">true</span>) {
              <span class="comment">// bind to the result of the binding expression passed to Qt.binding()</span>
              <span class="name">edgePosition</span> <span class="operator">=</span> <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> <span class="name">x</span> <span class="operator">+</span> <span class="name">width</span> })
          }
      }
  }

</pre>
<p>其次，在初始化动态构造对象的属性值时(通过<a href="qml-qtqml-component.html#createObject-method">Component.createObject()</a>或<a href="../qtquick/qml-qtquick-loader.html#setSource-method">Loader.setSource()</a>)应用属性绑定。</p>
<p>例如，假设存在一个DynamicText组件:</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
      <span class="name">id</span>: <span class="name">textElement</span>
      <span class="name">width</span>: <span class="number">200</span>
      <span class="name">height</span>: <span class="number">200</span>
      <span class="name">text</span>: <span class="string">&quot;Default text&quot;</span>
      property <span class="type"><a href="qml-string.html">string</a></span> <span class="name">dynamicText</span>: <span class="string">&quot;Dynamic text&quot;</span>
      <span class="name">onTextChanged</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="name">text</span>)
  }

</pre>
<p>的输出:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      <span class="name">id</span>: <span class="name">root</span>
      property <span class="type"><a href="qml-string.html">string</a></span> <span class="name">dynamicText</span>: <span class="string">&quot;Root text&quot;</span>

      <span class="name">Component</span>.onCompleted: {
          var c = <span class="name">Qt</span>.<span class="name">createComponent</span>(<span class="string">&quot;DynamicText.qml&quot;</span>)

          var obj1 = <span class="name">c</span>.<span class="name">createObject</span>(<span class="name">root</span>, { 'text': <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> <span class="name">dynamicText</span> <span class="operator">+</span> <span class="string">' extra text'</span> }) })
          <span class="name">root</span>.<span class="name">dynamicText</span> <span class="operator">=</span> <span class="string">&quot;Modified root text&quot;</span>

          var obj2 = <span class="name">c</span>.<span class="name">createObject</span>(<span class="name">root</span>, { 'text': <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> this.<span class="name">dynamicText</span> <span class="operator">+</span> <span class="string">' extra text'</span> }) })
          <span class="name">obj2</span>.<span class="name">dynamicText</span> <span class="operator">=</span> <span class="string">&quot;Modified dynamic text&quot;</span>
      }
  }

</pre>
<p>从:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      <span class="name">id</span>: <span class="name">root</span>
      property <span class="type"><a href="qml-string.html">string</a></span> <span class="name">dynamicText</span>: <span class="string">&quot;Root text&quot;</span>

      <span class="type"><a href="../qtquick/qml-qtquick-loader.html">Loader</a></span> {
          <span class="name">id</span>: <span class="name">loaderOne</span>
          <span class="name">onLoaded</span>: <span class="name">root</span>.<span class="name">dynamicText</span> <span class="operator">=</span> <span class="string">&quot;Modified root text&quot;</span>
      }

      <span class="type"><a href="../qtquick/qml-qtquick-loader.html">Loader</a></span> {
          <span class="name">id</span>: <span class="name">loaderTwo</span>
          <span class="name">onLoaded</span>: <span class="name">item</span>.<span class="name">dynamicText</span> <span class="operator">=</span> <span class="string">&quot;Modified dynamic text&quot;</span>
      }

      <span class="name">Component</span>.onCompleted: {
          <span class="name">loaderOne</span>.<span class="name">setSource</span>(<span class="string">&quot;DynamicText.qml&quot;</span>, { 'text': <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> <span class="name">dynamicText</span> <span class="operator">+</span> <span class="string">' extra text'</span> }) })
          <span class="name">loaderTwo</span>.<span class="name">setSource</span>(<span class="string">&quot;DynamicText.qml&quot;</span>, { 'text': <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> this.<span class="name">dynamicText</span> <span class="operator">+</span> <span class="string">' extra text'</span> }) })
      }
  }

</pre>
<p>应该都是:</p>
<pre class="cpp">

  Root text extra text
  Modified root text extra text
  Dynamic text extra text
  Modified dynamic text extra text

</pre>
<p>除非结果存储在绑定到var属性的数组中，否则不能在属性绑定声明中使用此函数(请参阅有关<a href="qtqml-syntax-propertybinding.html#qml-javascript-assignment">绑定声明和绑定赋值</a>的文档)。</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      <span class="name">width</span>: <span class="number">50</span>
      property <span class="type"><a href="qml-var.html">var</a></span> <span class="name">storedBindings</span>: [ <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> <span class="name">x</span> <span class="operator">+</span> <span class="name">width</span> }) ] <span class="comment">// stored</span>
      property <span class="type"><a href="qml-int.html">int</a></span> <span class="name">a</span>: <span class="name">Qt</span>.<span class="name">binding</span>(<span class="keyword">function</span>() { <span class="keyword">return</span> <span class="name">x</span> <span class="operator">+</span> <span class="name">width</span> }) <span class="comment">// error!</span>
      property <span class="type"><a href="qml-int.html">int</a></span> <span class="name">b</span>

      <span class="name">Component</span>.onCompleted: {
          <span class="name">b</span> <span class="operator">=</span> <span class="name">storedBindings</span>[<span class="number">0</span>] <span class="comment">// causes binding assignment</span>
      }
  }

</pre>
<p>该方法在Qt 5.0中进行了介绍。</p>
</div></div><!-- @@@binding -->
<br/>
<!-- $$$btoa -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="btoa-method">
<td class="tblQmlFuncNode"><p>
<a name="btoa-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">btoa</span>(<i>data</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>二进制到ASCII -这个函数返回base64编码的<code>data<span lang="zh-cn">(</span></code>数据<span lang="zh-cn">)</span>。</p>
</div></div><!-- @@@btoa -->
<br/>
<!-- $$$colorEqual -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="colorEqual-method">
<td class="tblQmlFuncNode"><p>
<a name="colorEqual-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">colorEqual</span>(<span class="type"><a href="../qtquick/qml-color.html">color</a></span> <i>lhs</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>rhs</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>如果<code>lhs</code> 和<code>rhs</code> 
		产生相同的颜色值，则返回true。这两个参数可以是颜色值或字符串值。<br>如果提供了字符串值，则必须将其转换为颜色，如<a href="../qtquick/qml-color.html#colorbasictypedocs">color</a>基本类型所述。</p>
</div></div><!-- @@@colorEqual -->
<br/>
<!-- $$$createComponent -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createComponent-method">
<td class="tblQmlFuncNode"><p>
<span class="type">object</span> <span class="name">createComponent</span>(<i>url</i>, <i>mode</i>, <i>parent</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回使用指定<i>url</i>处的QML文件创建的<a href="qml-qtqml-component.html">Component</a>对象，如果给出的是空字符串，则返回<code>null</code> 
		。</p>
<p>返回的组件的<a href="qml-qtqml-component.html#status-prop">Component::status</a>属性表示该组件是否创建成功。<br>
如果状态为<code>Component.Error</code>，请参见<a href="qml-qtqml-component.html#errorString-method">Component::errorString()</a>获取错误描述。</p>
<p>如果可选的mode参数设置为<code>Component.Asynchronous</code>，组件将在后台线程中加载。当<a href="qml-qtqml-component.html#status-prop">Component::status</a>属性正在加载时，它将是<code>Component.Loading</code>。如果组件加载成功，状态将变为<code>Component.Ready</code> 
，如果加载失败，状态将变为<code>Component.Error</code>。如果省略，该参数默认为<code>Component.PreferSynchronous</code>。</p>
<p>如果<i>mode</i> 设置为<code>Component.PreferSynchronous</code>, 
Qt将尝试同步加载组件，但如果有必要，可能会以异步加载方式结束。可能导致异步加载的场景包括但不限于:</p>
<ul>
<li>URL是指网络资源</li>
<li>该组件是作为异步加载的另一个组件创建的</li>
</ul>
<p>如果给出了可选的<i>parent</i> 参数，它应该引用将成为创建的<a href="qml-qtqml-component.html">Component</a>对象的父对象的对象。<br>
如果没有传递模式，这可以是第二个参数。</p>
<p>调用返回组件上的<a href="qml-qtqml-component.html#createObject-method">Component.createObject()</a>来创建组件的对象实例。</p>
<p>例如:</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      <span class="name">id</span>: <span class="name">container</span>
      <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">300</span>

      <span class="keyword">function</span> <span class="name">loadButton</span>() {
          var component = <span class="name">Qt</span>.<span class="name">createComponent</span>(<span class="string">&quot;Button.qml&quot;</span>);
          <span class="keyword">if</span> (<span class="name">component</span>.<span class="name">status</span> <span class="operator">==</span> <span class="name">Component</span>.<span class="name">Ready</span>) {
              var button = <span class="name">component</span>.<span class="name">createObject</span>(<span class="name">container</span>);
              <span class="name">button</span>.<span class="name">color</span> <span class="operator">=</span> <span class="string">&quot;red&quot;</span>;
          }
      }

      <span class="name">Component</span>.onCompleted: <span class="name">loadButton</span>()
  }

</pre>
<p>有关使用该函数的更多信息，请参阅<a href="qtqml-javascript-dynamicobjectcreation.html">从JavaScript创建动态QML对象</a>。</p>
<p>要从任意的QML字符串(而不是文件)创建QML对象，请使用<a href="qml-qtqml-qt.html#createQmlObject-method">Qt.createQmlObject()</a>。</p>
</div></div><!-- @@@createComponent -->
<br/>
<!-- $$$createQmlObject -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createQmlObject-method">
<td class="tblQmlFuncNode"><p>
<a name="createQmlObject-method"></a><span class="type">object</span> <span class="name">createQmlObject</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>qml</i>,  <span class="type">object</span> <i>parent</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>filepath</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回从给定的<i>qml</i> 
		字符串创建的新对象，该对象将具有指定的父对象，如果在创建对象时出现错误，则返回<code>null</code> 。</p>
<p>如果指定了<i>filepath</i> ，它将用于为创建的对象报告错误。</p>
<p>示例(其中<code>parentItem</code> 是现有QML项的id):</p>
<pre class="qml">

  var newObject = <span class="name">Qt</span>.<span class="name">createQmlObject</span>(<span class="string">'import QtQuick 2.0; Rectangle {color: &quot;red&quot;; width: 20; height: 20}'</span>,
                                     <span class="name">parentItem</span>,
                                     <span class="string">&quot;dynamicSnippet1&quot;</span>);

</pre>
<p>在出现错误的情况下，会抛出一个<a href="../qtscript/qtscript-index.html">Qt Script</a> 
error对象。该对象有一个附加属性<code>qmlErrors</code>，它是所遇到错误的数组。这个数组中的每个对象都有成员<code>lineNumber<span lang="zh-cn">(行号）</span></code>、<code>columnNumber<span lang="zh-cn">（列号）</span></code>、<code>fileName<span lang="zh-cn">（文件名）</span></code> 
和<code>message<span lang="zh-cn">（消息）</span></code>。例如，如果上面的代码片段将color拼错为'colro'，那么数组将包含如下对象:{"lineNumber": 
1， "columnNumber": 32， "fileName": "dynamicSnippet1"， "message": "Cannot assign 
to none property "colro""}。</p>
<p>注意，这个函数会立即返回，因此如果qml字符串加载了新组件(即尚未加载的外部qml文件)，这个函数可能无法工作。如果是这种情况，可以考虑使用<a href="qml-qtqml-qt.html#createComponent-method">Qt.createComponent()</a>。</p>
<p>有关使用该函数的更多信息，请参阅<a href="qtqml-javascript-dynamicobjectcreation.html">从JavaScript创建动态QML对象</a>。</p>
</div></div><!-- @@@createQmlObject -->
<br/>
<!-- $$$darker -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="darker-method">
<td class="tblQmlFuncNode"><p>
<a name="darker-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">darker</span>(<span class="type"><a href="../qtquick/qml-color.html">color</a></span> <i>baseColor</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>factor</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>根据提供的<code>factor<span lang="zh-cn">(因子）</span></code> 
		返回比<code>baseColor<span lang="zh-cn">（基本颜色）</span></code> 更深的颜色。</p>
<p>如果因子大于1.0，则该函数返回较深的颜色。将系数设置为3.0返回亮度为三分之一的颜色。<br>
如果系数小于1.0，则返回颜色较浅，但我们建议为此使用Qt.<a href="qml-qtqml-qt.html#lighter-method">lighter()</a>函数。如果因子为0或负数，则返回值未指定。</p>
<p>该函数将当前RGB颜色转换为HSV，将value (V)分量除以因子，将颜色转换回RGB。</p>
<p>如果未提供<code>factor<span lang="zh-cn">（因子）</span></code> ，则返回比<code>baseColor</code> 
(factor 2.0)暗50%的颜色。</p>
</div></div><!-- @@@darker -->
<br/>
<!-- $$$exit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="exit-method">
<td class="tblQmlFuncNode"><p>
<a name="exit-method"></a><span class="name">exit</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>retCode</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>这个函数会触发<a href="qqmlengine.html#exit">QQmlEngine::exit</a>(int)信号。在<a href="../qtdoc/qtquick-qmlscene.html">使用qmlscene的Prototypinge</a>中，这会导致启动程序应用程序退出指定的返回代码。要在调用此方法时使用指定的返回代码退出事件循环，C++应用程序可以将<a href="../qtcore/qcoreapplication.html#exit">QCoreApplication::exit</a>(int)信号连接到<a href="qqmlengine.html#exit">QQmlEngine::exit</a>(int)槽。</p>
<p><b>请参考 </b><a href="qml-qtqml-qt.html#quit-method">quit()</a>.</p>
</div></div><!-- @@@exit -->
<br/>
<!-- $$$font -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font-method">
<td class="tblQmlFuncNode"><p>
<a name="font-method"></a><span class="name">font</span>(<span class="type">object</span> <i>fontSpecifier</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>&nbsp;返回一个带有在<code>fontSpecifier</code> 
		对象中指定的属性或最近匹配的字体的字体。<br> <code>fontSpecifier</code> 
		对象应该包含键值对，其中有效键是字体类型的子属性名，值是每个子属性的有效值。<br>无效的键将被忽略。</p>
</div></div><!-- @@@font -->
<br/>
<!-- $$$fontFamilies -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fontFamilies-method">
<td class="tblQmlFuncNode"><p>
<a name="fontFamilies-method"></a><span class="type"><a href="qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-string.html">string</a></span>&gt; <span class="name">fontFamilies</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回应用程序可用的字体系列的列表。</p>
</div></div><!-- @@@fontFamilies -->
<br/>
<!-- $$$formatDate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="formatDate-method">
<td class="tblQmlFuncNode"><p>
<a name="formatDate-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">formatDate</span>(<span class="type">datetime</span> <i>date</i>,  <span class="type"><a href="qml-variant.html">variant</a></span> <i>format</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回<code>date<span lang="zh-cn">（</span></code>日期<span lang="zh-cn">）</span>的字符串表示形式，可根据格式进行可选的<code>format<span lang="zh-cn">（格式）</span></code>。</p>
<p><i>date</i> 参数可以是JavaScript <code><span lang="zh-cn">d</span>ate</code> 对象、<a href="qml-date.html">date</a>属性、<a href="../qtcore/qdate.html">QDate</a>或<a href="../qtcore/qdatetime.html">QDateTime</a>值。<br>
format参数可以是<a href="qml-qtqml-qt.html#formatDateTime-method">Qt.formatDateTime</a>()中描述的任何可能的格式值。</p>
<p>如果未指定<i>format</i> ，则使用<a href="../qtcore/qt.html#DateFormat-enum">Qt.DefaultLocaleShortDate</a>格式化日期。</p>
<p><b>请参考 </b><a href="qml-qtqml-locale.html">Locale</a>.</p>
</div></div><!-- @@@formatDate -->
<br/>
<!-- $$$formatDateTime -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="formatDateTime-method">
<td class="tblQmlFuncNode"><p>
<a name="formatDateTime-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">formatDateTime</span>(<span class="type">datetime</span> <i>dateTime</i>,  <span class="type"><a href="qml-variant.html">variant</a></span> <i>format</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回<code>datetime</code>的字符串表示形式，可根据<code>format</code>可选地格式化。</p>
<p><i>date</i> 参数可以是JavaScript <code>Date</code> 对象、<a href="qml-date.html">date</a>属性、<a href="../qtcore/qdate.html">QDate</a>、<a href="../qtcore/qtime.html">QTime</a>或<a href="../qtcore/qdatetime.html">QDateTime</a>值。</p>
<p>如果没有提供<i>format</i> , <i>dateTime</i> 将使用<a href="../qtcore/qt.html#DateFormat-enum">Qt.DefaultLocaleShortDate</a>格式化。否则，格式应为:</p>
<ul>
<li><span lang="zh-cn"><a href="../qtcore/qt.html#DateFormat-enum">Qt::DateFormat</a>枚举值之一，如<code>Qt.DefaultLocaleShortDate</code>或<code>Qt.ISODate </code>
</span></li>
<li>一个指定返回字符串格式的字符串，详细内容如下。</li>
</ul>
<p>如果<i>format</i> 指定了一个格式字符串，它应该使用以下表达式来指定日期:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th ><span lang="zh-cn">表达式</span></th><th >
	 <span lang="zh-cn">输出</span></th></tr></thead>
<tr valign="top" class="odd"><td >d</td><td >没有前导零的日子(1到31)</td></tr>
<tr valign="top" class="even"><td >dd</td><td >前导为0的日子(01到31)</td></tr>
<tr valign="top" class="odd"><td >ddd</td><td >他简化了本地化日的名称(例如:“<span lang="zh-cn">Mon</span>”“<span lang="zh-cn">Sun</span>”)。使用QDate: 
	shortDayName()。</td></tr>
<tr valign="top" class="even"><td >dddd</td><td >较长的本地化日名(例如。“周一”“<a href="../qtcore/qt.html#DayOfWeek-enum">Qt::Sunday</a>”)。使用QDate: 
	longDayName()。</td></tr>
<tr valign="top" class="odd"><td >M</td><td >这个月的数字没有领先的0(1-12)</td></tr>
<tr valign="top" class="even"><td >MM</td><td >前导零的月份(01-12)</td></tr>
<tr valign="top" class="odd"><td >MMM</td><td >
	缩写的本地化月份名(例如。“Jan”“Dec”)。使用QDate:: shortMonthName ()</td></tr>
<tr valign="top" class="even"><td >MMMM</td><td >
	较长的本地化月份名称(例如。“January”“December”)。使用QDate:: longMonthName ()</td></tr>
<tr valign="top" class="odd"><td >yy</td><td >两位数年份(00-99)</td></tr>
<tr valign="top" class="even"><td >yyyy</td><td >以四位数表示的年份</td></tr>
</table></div>
<p>此外，以下表达式可以用来指定时间:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th ><span lang="zh-cn">表达式</span></th><th >
	 <span lang="zh-cn">输出</span></th></tr></thead>
<tr valign="top" class="odd"><td >h</td><td >没有前导零的小时数(如果显示AM/PM，则为0到23或1到12)</td></tr>
<tr valign="top" class="even"><td >hh</td><td >前导零的小时(00至23或01至12(如果显示AM/PM))</td></tr>
<tr valign="top" class="odd"><td >m</td><td >没有前导零的分钟（0到59）</td></tr>
<tr valign="top" class="even"><td >mm</td><td >有前导零的分钟（0<span lang="zh-cn">0</span>到59）</td></tr>
<tr valign="top" class="odd"><td >s</td><td >没有前导零的<span lang="zh-cn">秒</span>（0到59）</td></tr>
<tr valign="top" class="even"><td >ss</td><td >有前导零的<span lang="zh-cn">秒</span>（<span lang="zh-cn">0</span>0到59）</td></tr>
<tr valign="top" class="odd"><td >z</td><td >没有前导零的毫秒数(0到999)</td></tr>
<tr valign="top" class="even"><td >zzz</td><td >有前导零的毫秒数(0<span lang="zh-cn">00</span>到999)</td></tr>
<tr valign="top" class="odd"><td >AP</td><td >使用AM / PM显示。AP将被AM或PM取代。</td></tr>
<tr valign="top" class="even"><td >ap</td><td >使用am/pm显示。<span lang="zh-cn">a</span>p将被am或pm取代。</td></tr>
<tr valign="top" class="odd"><td >t</td><td >包括一个时区指示器。</td></tr>
</table></div>
<p>所有其他输入字符将被忽略。任何用单引号括起来的字符序列都将被视为文本，而不是用作表达式。<br>在输出中，两个连续的单引号(" " ")被一个单引号替换。</p>
<p>例如，如果指定了以下日期/时间值:</p>
<pre class="cpp">

  <span class="comment">// 21 May 2001 14:13:09</span>
  var dateTime <span class="operator">=</span> <span class="keyword">new</span> Date(<span class="number">2001</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="number">21</span><span class="operator">,</span> <span class="number">14</span><span class="operator">,</span> <span class="number">13</span><span class="operator">,</span> <span class="number">09</span>)

</pre>
<p>这个<i>dateTime</i> 值可以传递给<code>Qt.formatDateTime()</code>、<a href="qml-qtqml-qt.html#formatDate-method">Qt.formatDate()</a>或 <a href="qml-qtqml-qt.html#formatTime-method">Qt.formatTime()</a>，格式值如下:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Format</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >&quot;dd.MM.yyyy&quot;</td><td >21.05.2001</td></tr>
<tr valign="top" class="even"><td >&quot;ddd MMMM d yy&quot;</td><td >Tue May 21 01</td></tr>
<tr valign="top" class="odd"><td >&quot;hh:mm:ss.zzz&quot;</td><td >14:13:09.042</td></tr>
<tr valign="top" class="even"><td >&quot;h:m:s ap&quot;</td><td >2:13:9 pm</td></tr>
</table></div>
<p><b>请参考 </b><a href="qml-qtqml-locale.html">Locale</a><span lang="zh-cn">。</span></p>
</div></div><!-- @@@formatDateTime -->
<br/>
<!-- $$$formatTime -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="formatTime-method">
<td class="tblQmlFuncNode"><p>
<a name="formatTime-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">formatTime</span>(<span class="type">datetime</span> <i>time</i>,  <span class="type"><a href="qml-variant.html">variant</a></span> <i>format</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回<code>time<span lang="zh-cn">（时间）</span></code>的字符串表示形式，可根据格式进行可选<code>format</code>。</p>
<p>time参数可以是JavaScript <code>Date</code> 对象、<a href="../qtcore/qtime.html">QTime</a>或<a href="../qtcore/qdatetime.html">QDateTime</a>值。<br> <i>format</i> 
参数可以是<a href="qml-qtqml-qt.html#formatDateTime-method">Qt.formatDateTime()</a>中描述的任何可能的格式值。</p>
<p>如果未指定<i>format</i> ，则使用<a href="../qtcore/qt.html#DateFormat-enum">Qt.DefaultLocaleShortDate</a>格式化<i>time</i> 
<span lang="zh-cn">（</span>时间<span lang="zh-cn">）</span>。</p>
<p><b>请参考 </b><a href="qml-qtqml-locale.html">Locale</a><span lang="zh-cn">。</span></p>
</div></div><!-- @@@formatTime -->
<br/>
<!-- $$$hsla -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="hsla-method">
<td class="tblQmlFuncNode"><p>
<a name="hsla-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">hsla</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>hue</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>saturation</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>lightness</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>alpha</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回带有指定<code>hue<span lang="zh-cn">（色相）</span></code>、<code>saturation<span lang="zh-cn">（饱和度）</span></code>、<code>lightness<span lang="zh-cn">（亮度）</span></code> 
		和<code>alpha</code> 组件的颜色。所有的分量都应该在0-1范围内。</p>
</div></div><!-- @@@hsla -->
<br/>
<!-- $$$hsva -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="hsva-method">
<td class="tblQmlFuncNode"><p>
<a name="hsva-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">hsva</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>hue</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>saturation</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>value</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>alpha</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns a color with the specified , <code>saturation</code>, <code>value</code> and <code>alpha</code> components. All components should be in the range 0-1 inclusive.返回带有指定<code>hue<span lang="zh-cn">（色相）</span></code>、<code>saturatio<span lang="zh-cn">n（饱和度）</span></code>、<code>valu<span lang="zh-cn">e（值）</span></code>和alpha组件的颜色。所有的分量都应该在0-1范围内。</p>
<p>在Qt 5.5中介绍了这种方法。</p>
</div></div><!-- @@@hsva -->
<br/>
<!-- $$$include -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="include-method">
<td class="tblQmlFuncNode"><p>
<a name="include-method"></a><span class="type">object</span> <span class="name">include</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>url</i>,  <span class="type">jsobject</span> <i>callback</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>
		包含另一个JavaScript文件。此方法只能在JavaScript文件中使用，而不是常规的QML文件。</p>
<p>这将从<i>url</i> 导入所有函数到当前脚本的名称空间。</p>
<p>Qt.include()返回一个描述操作状态的对象。该对象有一个属性status，它被设置为以下值之一:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th ><span lang="zh-cn">符号</span></th><th >
	 <span lang="zh-cn">值</span></th><th >描述</th></tr></thead>
<tr valign="top" class="odd"><td >result.OK</td><td >0</td><td >包含成功完成。</td></tr>
<tr valign="top" class="even"><td >result.LOADING</td><td >1</td><td >正在从网络加载数据。</td></tr>
<tr valign="top" class="odd"><td >result.NETWORK_ERROR</td><td >2</td><td >
	在获取url时发生了网络错误。</td></tr>
<tr valign="top" class="even"><td >result.EXCEPTION</td><td >3</td><td >
	在执行包含的代码时发生了一个JavaScript异常。在这种情况下，将设置一个额外的<code>exception</code> 属性。</td></tr>
</table></div>
<p><code>status</code> 属性将随着操作的进行而更新。</p>
<p>如果提供，则在操作完成时调用<i>callback</i> <span lang="zh-cn">(</span>回调<span lang="zh-cn">)</span>。回调函数传递的对象与从Qt.include()调用返回的对象相同。</p>
</div></div><!-- @@@include -->
<br/>
<!-- $$$isQtObject -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="isQtObject-method">
<td class="tblQmlFuncNode"><p>
<a name="isQtObject-method"></a><span class="type"><a href="qml-bool.html">bool</a></span> <span class="name">isQtObject</span>(<i>object</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>如果<code>object</code> 
		是对Qt或QML对象的有效引用，则返回true，否则返回false。</p>
</div></div><!-- @@@isQtObject -->
<br/>
<!-- $$$lighter -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="lighter-method">
<td class="tblQmlFuncNode"><p>
<a name="lighter-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">lighter</span>(<span class="type"><a href="../qtquick/qml-color.html">color</a></span> <i>baseColor</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>factor</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>根据提供的<code>factor</code> <span lang="zh-cn">(</span>因子<span lang="zh-cn">)</span>返回比<code>baseColor</code> 
		浅的颜色。</p>
<p>如果因子大于1.0，该函数返回较浅的颜色。将系数设置为1.5返回的颜色亮度为50%。如果因子小于1.0，则返回颜色较深，但我们建议为此使用Qt.<a href="qml-qtqml-qt.html#darker-method">darker()</a>函数。如果因子为0或负数，则返回值未指定。</p>
<p>该函数将当前RGB颜色转换为HSV,通过因子将值(V)分量乘以因子,并将颜色转换回RGB。</p>
<p>如果未提供<code>factor</code> ，则返回比<code>baseColor</code> (factor 1.5)浅50%的颜色。</p>
</div></div><!-- @@@lighter -->
<br/>
<!-- $$$locale -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="locale-method">
<td class="tblQmlFuncNode"><p>
<a name="locale-method"></a><span class="name">locale</span>(<i>name</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>
		返回一个带有指定名称的JS对象,它具有格式是：语言[_domain][.codeset][(@modifier]或“C”,<span lang="zh-cn">如下</span>:</p>
<ul>
<li><span lang="zh-cn">语言</span>是两个字母的小写字母，ISO 639语言代码，</li>
<li>territory是两个字母的大写字母，ISO 3166国家代码，</li>
<li>代码集<span lang="zh-cn">（codeset ）</span>和修饰符<span lang="zh-cn">（modifier ）</span>被忽略。</li>
</ul>
<p>如果字符串违反区域设置格式，或者语言不是有效的ISO 369代码，则使用“C”区域设置。<br>如果国家不存在，或者不是有效的ISO 
3166代码，则为指定的语言选择最合适的国家。</p>
<p><b>请参考 </b><a href="qml-qtqml-locale.html">Locale</a><span lang="zh-cn">。</span></p>
</div></div><!-- @@@locale -->
<br/>
<!-- $$$md5 -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="md5-method">
<td class="tblQmlFuncNode"><p>
<a name="md5-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">md5</span>(<i>data</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回<code>data<span lang="zh-cn">（</span></code>数据<span lang="zh-cn">）</span>的md5哈希值的十六进制字符串。</p>
</div></div><!-- @@@md5 -->
<br/>
<!-- $$$matrix4x4 -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="matrix4x4-method">
<td class="tblQmlFuncNode"><p>
<a name="matrix4x4-method"></a><span class="name">matrix4x4</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>m11</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m12</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m13</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m14</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m21</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m22</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m23</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m24</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m31</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m32</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m33</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m34</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m41</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m42</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m43</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>m44</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>
		返回带有指定值的Matrix4x4。或者，也可以用一个参数调用函数，该参数是一个JavaScript数组，包含16个矩阵值。最后，可以不带参数调用函数，结果矩阵将是单位矩阵。</p>
</div></div><!-- @@@matrix4x4 -->
<br/>
<!-- $$$openUrlExternally -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="openUrlExternally-method">
<td class="tblQmlFuncNode"><p>
<a name="openUrlExternally-method"></a><span class="type"><a href="qml-bool.html">bool</a></span> <span class="name">openUrlExternally</span>(<span class="type"><a href="qml-url.html">url</a></span> <i>target</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>根据用户的桌面首选项，尝试在外部应用程序中打开指定的<code>target</code> 
		<span lang="zh-cn">（</span>目标<span lang="zh-cn">）</span>url。如果成功则返回true，否则返回false。</p>
<p><b>警告:</b>返回值为<code>true</code> 表示应用程序已成功请求操作系统在外部应用程序中打开URL。<br>
外部应用程序仍然可能无法启动或无法打开所请求的URL。<br>此结果将不会报告给应用程序。</p>
</div></div><!-- @@@openUrlExternally -->
<br/>
<!-- $$$point -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="point-method">
<td class="tblQmlFuncNode"><p>
<a name="point-method"></a><span class="type"><a href="qml-qtqml-qt.html#point-method">point</a></span> <span class="name">point</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>x</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回具有指定<code>x</code>和<code>y</code>坐标的点。</p>
</div></div><!-- @@@point -->
<br/>
<!-- $$$qsTr -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="qsTr-method">
<td class="tblQmlFuncNode"><p>
<a name="qsTr-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">qsTr</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>sourceText</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>disambiguation</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>n</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回<i>sourceText</i>的翻译版本，可选地基于<i>disambiguation</i> 
		<span lang="zh-cn">（</span>消歧<span lang="zh-cn">）</span>字符串和包含复数的字符串的值<i>n</i>;<br>
		否则，如果没有合适的翻译字符串可用，则返回sourceText本身。</p>
<p>如果相同的sourceText在相同的翻译上下文中用于不同的角色，则可能会传入一个额外的标识字符串以消除<i>disambiguation<span lang="zh-cn">（</span></i>歧义<span lang="zh-cn">）</span>。 </p>
<p><span lang="zh-cn">例如：</span></p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;hello&quot;</span>) }

</pre>
<p><b>请参考 </b><a href="../qtdoc/qtquick-internationalization.html">Qt 
Quick的国际化和本地化。</a></p>
</div></div><!-- @@@qsTr -->
<br/>
<!-- $$$qsTrId -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="qsTrId-method">
<td class="tblQmlFuncNode"><p>
<a name="qsTrId-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">qsTrId</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>id</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>n</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回由id标识的已翻译字符串。如果没有找到匹配的字符串，则返回<i>id</i>本身。这在正常情况下不应该发生。</p>
<p>如果<i>n</i> &gt;= 0，则结果字符串中出现的所有<code>%n</code>将被替换为<i>n</i>的十进制表示。此外，根据n的值，翻译文本可能会有所不同。</p>
<p><span lang="zh-cn">例如：</span></p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">qsTrId</span>(<span class="string">&quot;hello_id&quot;</span>) }

</pre>
<p>可以提供如下的源字符串模板:</p>
<p><code>//% &lt;string&gt;</code></p>
<p><span lang="zh-cn">或</span></p>
<p><code>\begincomment% &lt;string&gt; \endcomment</code></p>
<p><span lang="zh-cn">例如：</span></p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
      <span class="comment">//% &quot;hello&quot;</span>
      <span class="name">text</span>: <span class="name">qsTrId</span>(<span class="string">&quot;hello_id&quot;</span>)
  }

</pre>
<p>创建适合使用此函数的二进制翻译(QM)文件需要将<code>-idbased</code>选项传递给<code>lrelease</code> 工具。</p>
<p><b>请参考 </b><a href="../qtcore/qtglobal.html#QT_TRID_NOOP">QT_TRID_NOOP()</a> and<span lang="zh-cn">
</span><a href="../qtdoc/qtquick-internationalization.html">Qt Quick的国际化和本地化</a><span lang="zh-cn">。</span></p>
</div></div><!-- @@@qsTrId -->
<br/>
<!-- $$$qsTrIdNoOp -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="qsTrIdNoOp-method">
<td class="tblQmlFuncNode"><p>
<a name="qsTrIdNoOp-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">qsTrIdNoOp</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>id</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>标记用于动态翻译的id。</p>
<p>Returns the <i>id</i>.</p>
<p><a href="../qtcore/qtglobal.html#QT_TRID_NOOP">QT_TRID_NOOP</a> is used in conjunction with the dynamic translation function <a href="qml-qtqml-qt.html#qsTrId-method">qsTrId()</a>. It identifies a string as requiring translation (so it can be identified by <code>lupdate</code>), but leaves the actual translation to <a href="qml-qtqml-qt.html#qsTrId-method">qsTrId()</a>.</p>
<p>Example:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      property <span class="type"><a href="qml-string.html">string</a></span> <span class="name">greetingId</span>: <span class="name">QT_TRID_NOOP</span>(<span class="string">&quot;hello_id&quot;</span>)

      <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">qsTrId</span>(<span class="name">greetingId</span>) }
  }

</pre>
<p><b>请参考 </b><a href="qml-qtqml-qt.html#qsTrId-method">qsTrId()</a> and 
<a href="../qtdoc/qtquick-internationalization.html">Qt Quick的国际化和本地化</a><span lang="zh-cn">。</span></p>
</div></div><!-- @@@qsTrIdNoOp -->
<br/>
<!-- $$$qsTrNoOp -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="qsTrNoOp-method">
<td class="tblQmlFuncNode"><p>
<a name="qsTrNoOp-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">qsTrNoOp</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>sourceText</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>disambiguation</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>为动态翻译标记<i>sourceText</i> ;例如，存储的<i>sourceText</i> 
		将不会被更改。</p>
<p>如果相同的<i>sourceText</i> 在相同的翻译上下文中用于不同的角色，则可能会传入一个额外的标识字符串以<i>disambiguation<span lang="zh-cn">（</span></i>消除<span lang="zh-cn">）</span>歧义。</p>
<p>Returns the <i>sourceText</i>.</p>
<p>&nbsp;<a href="../qtcore/qtglobal.html#QT_TR_NOOP">QT_TR_NOOP</a>与动态翻译函数<a href="qml-qtqml-qt.html#qsTr-method">qsTr()</a>和<a href="qml-qtqml-qt.html#qsTranslate-method">qsTranslate()</a>()一起使用。它将一个字符串标识为需要转换的字符串(因此可以由lupdate标识它)，但将实际的转换留给动态函数。</p>
<p>Example:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      property <span class="type"><a href="qml-string.html">string</a></span> <span class="name">greeting</span>: <span class="name">QT_TR_NOOP</span>(<span class="string">&quot;hello&quot;</span>)

      <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">qsTr</span>(<span class="name">greeting</span>) }
  }

</pre>
<p><b>请参考 </b><a href="../qtdoc/qtquick-internationalization.html">Qt 
Quick的国际化和本地化。</a></p>
</div></div><!-- @@@qsTrNoOp -->
<br/>
<!-- $$$qsTranslate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="qsTranslate-method">
<td class="tblQmlFuncNode"><p>
<a name="qsTranslate-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">qsTranslate</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>context</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>sourceText</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>disambiguation</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>n</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回给定上下文中<i>sourceText</i> 的翻译版本，可选地基于<i>disambiguation</i> 
		<span lang="zh-cn">（</span>消歧<span lang="zh-cn">）</span>字符串和包含复数的字符串的值n;否则，如果没有合适的翻译字符串可用，则返回sourceText本身。</p>
<p><i>disambiguation</i>.如果相同的sourceText在相同的翻译<i>context<span lang="zh-cn">（</span></i>上下文<span lang="zh-cn">）</span>中用于不同的角色，则可能会传入一个额外的标识字符串以<i>disambiguation</i> 
<span lang="zh-cn">（</span>消歧<span lang="zh-cn">）</span>。</p>
<p>Example:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">qsTranslate</span>(<span class="string">&quot;CustomContext&quot;</span>, <span class="string">&quot;hello&quot;</span>) }

</pre>
<p><b>请参考 </b><a href="../qtdoc/qtquick-internationalization.html">Qt 
Quick的国际化和本地化。</a></p>
</div></div><!-- @@@qsTranslate -->
<br/>
<!-- $$$qsTranslateNoOp -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="qsTranslateNoOp-method">
<td class="tblQmlFuncNode"><p>
<a name="qsTranslateNoOp-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">qsTranslateNoOp</span>(<span class="type"><a href="qml-string.html">string</a></span> <i>context</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>sourceText</i>,  <span class="type"><a href="qml-string.html">string</a></span> <i>disambiguation</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>将<i>sourceText</i> 标记为给定上下文中的动态翻译;<br>例如，存储的<i>sourceText</i> 
		将不会被更改。</p>
<p>如果相同的<i>sourceText</i> 在相同的翻译上下文中用于不同的角色，则可能会传入一个额外的标识字符串以<i>disambiguation<span lang="zh-cn">（</span></i>消除歧义<span lang="zh-cn">）</span>。</p>
<p>Returns the <i>sourceText</i>.</p>
<p>&nbsp;<a href="../qtcore/qtglobal.html#QT_TRANSLATE_NOOP">QT_TRANSLATE_NOOP</a>与动态翻译函数<a href="qml-qtqml-qt.html#qsTr-method">qsTr()</a>和<a href="qml-qtqml-qt.html#qsTranslate-method">qsTranslate()</a>一起使用。<br>
它将一个字符串标识为需要转换的字符串(因此可以由lupdate标识它)，但将实际的转换留给动态函数。</p>
<p>Example:</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      property <span class="type"><a href="qml-string.html">string</a></span> <span class="name">greeting</span>: <span class="name">QT_TRANSLATE_NOOP</span>(<span class="string">&quot;CustomContext&quot;</span>, <span class="string">&quot;hello&quot;</span>)

      <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">qsTranslate</span>(<span class="string">&quot;CustomContext&quot;</span>, <span class="name">greeting</span>) }
  }

</pre>
<p><b>请参考 </b><a href="../qtdoc/qtquick-internationalization.html">Qt 
Quick的国际化和本地化。</a></p>
</div></div><!-- @@@qsTranslateNoOp -->
<br/>
<!-- $$$quaternion -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="quaternion-method">
<td class="tblQmlFuncNode"><p>
<a name="quaternion-method"></a><span class="name">quaternion</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>scalar</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>y</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>z</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回带有指定<code>scalar<span lang="zh-cn">（</span></code>标量<code><span lang="zh-cn">）</span>x</code>、<code>y</code>和<code>z</code>的四元数。</p>
</div></div><!-- @@@quaternion -->
<br/>
<!-- $$$quit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="quit-method">
<td class="tblQmlFuncNode"><p>
<a name="quit-method"></a><span class="name">quit</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>这个函数会触发<a href="qqmlengine.html#quit">QQmlEngine::quit()</a>信号。在<a href="../qtdoc/qtquick-qmlscene.html">使用qmlscene的Prototyping</a>中，这会导致启动程序退出;要在调用此方法时退出C++应用程序，请将<a href="qqmlengine.html#quit">QQmlEngine::quit()</a>信号连接到<a href="../qtcore/qcoreapplication.html#quit">QCoreApplication::quit()</a>槽。</p>
<p><b>请参考 </b><a href="qml-qtqml-qt.html#exit-method">exit()</a>.</p>
</div></div><!-- @@@quit -->
<br/>
<!-- $$$rect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rect-method">
<td class="tblQmlFuncNode"><p>
<a name="rect-method"></a><span class="type"><a href="qml-qtqml-qt.html#rect-method">rect</a></span> <span class="name">rect</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>x</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>y</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>width</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>height</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>在<code>x</code>、<code>y</code>和指定的<code>width</code> 
		<span lang="zh-cn">（</span>宽度<span lang="zh-cn">）</span>和<code>height<span lang="zh-cn">（</span></code>高度<span lang="zh-cn">）</span>返回一个<code>rect</code> 
		。</p>
<p>The returned object has <code>x</code>, <code>y</code>, <code>width</code> and <code>height</code> attributes with the given values.返回的对象具有给定值的<code>x</code>、<code>y</code>和<code>width</code> 
<span lang="zh-cn">（</span>宽度<span lang="zh-cn">）</span>和<code>height<span lang="zh-cn">（</span></code>高度<span lang="zh-cn">）</span>属性。</p>
</div></div><!-- @@@rect -->
<br/>
<!-- $$$resolvedUrl -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="resolvedUrl-method">
<td class="tblQmlFuncNode"><p>
<a name="resolvedUrl-method"></a><span class="type"><a href="qml-url.html">url</a></span> <span class="name">resolvedUrl</span>(<span class="type"><a href="qml-url.html">url</a></span> <i>url</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回相对于调用者的<i>url</i> 解析的<i>url</i> 。</p>
</div></div><!-- @@@resolvedUrl -->
<br/>
<!-- $$$rgba -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rgba-method">
<td class="tblQmlFuncNode"><p>
<a name="rgba-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">rgba</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>red</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>green</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>blue</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>alpha</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回带有指定的<code>red<span lang="zh-cn">（</span></code>红色<span lang="zh-cn">）</span>、<code>green<span lang="zh-cn">（</span></code>绿色<span lang="zh-cn">）</span>、<code>blue</code> 
		<span lang="zh-cn">（</span>蓝色<span lang="zh-cn">）</span>和<code>alpha</code> 
		组件的颜色。所有的分量都应该在0-1范围内。</p>
</div></div><!-- @@@rgba -->
<br/>
<!-- $$$size -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="size-method">
<td class="tblQmlFuncNode"><p>
<a name="size-method"></a><span class="name">size</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>width</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>height</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回具有指定<code>width</code> <span lang="zh-cn">（</span>宽度<span lang="zh-cn">）</span>和<code>height<span lang="zh-cn">（</span></code>高度<span lang="zh-cn">）</span>的大小。</p>
</div></div><!-- @@@size -->
<br/>
<!-- $$$tint -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="tint-method">
<td class="tblQmlFuncNode"><p>
<a name="tint-method"></a><span class="type"><a href="../qtquick/qml-color.html">color</a></span> <span class="name">tint</span>(<span class="type"><a href="../qtquick/qml-color.html">color</a></span> <i>baseColor</i>,  <span class="type"><a href="../qtquick/qml-color.html">color</a></span> <i>tintColor</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>这个函数允许用一种颜色着色另一种颜色。</p>
<p>色调通常应该是透明的，否则你将无法看到潜在的颜色。<br>下面的例子提供了一个轻微的红色色调，颜色是纯红色，只有1/16不透明。</p>
<pre class="qml">

  <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">x</span>: <span class="number">0</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
          <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span>
      }
      <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">x</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
          <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">tint</span>(<span class="string">&quot;lightsteelblue&quot;</span>, <span class="string">&quot;#10FF0000&quot;</span>)
      }
  }

</pre>
<p class="centerAlign"><img src="images/declarative-rect_tint.png" alt="" /></p><p>
		当由于某些事件而要传达微妙的变化时，色调是最有用的;然后，您可以使用着色来更有效地调整可见颜色。</p>
</div></div><!-- @@@tint -->
<br/>
<!-- $$$vector2d -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="vector2d-method">
<td class="tblQmlFuncNode"><p>
<a name="vector2d-method"></a><span class="name">vector2d</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回带有指定<code>x</code>和<code>y</code>的Vector2D。</p>
</div></div><!-- @@@vector2d -->
<br/>
<!-- $$$vector3d -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="vector3d-method">
<td class="tblQmlFuncNode"><p>
<a name="vector3d-method"></a><span class="name">vector3d</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>y</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>z</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回带有指定<code>x</code>, <code>y</code>和<code>z</code>的Vector3D。</p>
</div></div><!-- @@@vector3d -->
<br/>
<!-- $$$vector4d -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="vector4d-method">
<td class="tblQmlFuncNode"><p>
<a name="vector4d-method"></a><span class="name">vector4d</span>(<span class="type"><a href="qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>y</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>z</i>,  <span class="type"><a href="qml-real.html">real</a></span> <i>w</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回带有指定<code>x</code>, <code>y</code>,<code><span lang="zh-cn">
		</span>z</code>和<code>w</code>的Vector4D。</p>
</div></div><!-- @@@vector4d -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
